package common;

import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;

import math.common.MathCommon;
import math.probability.ExpDistribution;
import math.probability.NormalDistribution;

public class TestMomentsEstimation {
	
	public static void main(String arg[]) throws FileNotFoundException  {
//		PrintWriter out = new PrintWriter("testMomentsEst.csv");
		int M = 10000;
		
//		out.println("N_m4,E_m4");
		int N[] = {50, 100, 500};
		System.out.println("n  N_m4  Var_N_m4  E_m4  Var_E_m4");
		for (int n : N) {
			ArrayList<Double> N_m4 = new ArrayList<Double>();
			ArrayList<Double> E_m4 = new ArrayList<Double>();
		for (int i=0; i<M; i++) { 
			N_m4.add(MathCommon.get4Moment((new NormalDistribution(0.0, 1.0)).getSample(n)));
			E_m4.add(MathCommon.get4Moment((new ExpDistribution(1.0)).getSample(n)));
		}
		System.out.println(n + "  " + MathCommon.getMean(N_m4) + "  " + Math.sqrt(MathCommon.getVar(N_m4))
				+ "  " + MathCommon.getMean(E_m4)+ "  " + Math.sqrt(MathCommon.getVar(E_m4)));
		}
//		out.flush();
//		out.close();
	}

}
